function [x,y]= animate_ATRIAS_leg(x0,y0,xt,yt,l0)

l=sqrt((x0-xt)^2+(y0-yt)^2);    %current leg length
phi=atan2(y0-yt,xt-x0);         %leg angle
l2=l0/2+0.02;                   %ATRIAS leg length
phi_l=acos(l/2/l2);             %ATRIAS leg angle
l3=0.05;                        %ATRIAS leg foot offset

%ATRIAS leg

x(1)=xt;
y(1)=yt;

x(2)=x0+l2*cos(phi+phi_l); %rear knee
y(2)=y0-l2*sin(phi+phi_l);

x(3)=x0;
y(3)=y0;

x(4)=x0+l2*cos(phi-phi_l); %front knee
y(4)=y0-l2*sin(phi-phi_l);

x(5)=xt-l3*cos(phi-phi_l); %connection point
y(5)=yt+l3*sin(phi-phi_l);
